home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / dplobby.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-02-09  |  13.6 KB  |  384 lines

  1. /*==========================================================================;
  2.  *
  3.  *  Copyright (C) 1996 Microsoft Corporation.  All Rights Reserved.
  4.  *
  5.  *  File:       dplobby.h
  6.  *  Content:    DirectPlayLobby include file
  7.  ***************************************************************************/
  8. #ifndef __DPLOBBY_INCLUDED__
  9. #define __DPLOBBY_INCLUDED__
  10. #pragma option push -b
  11.  
  12. #include "dplay.h"
  13.  
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif /* __cplusplus */
  17.  
  18. /*
  19.  * GUIDS used by DirectPlay objects
  20.  */
  21.  
  22. /* {AF465C71-9588-11cf-A020-00AA006157AC} */
  23. DEFINE_GUID(IID_IDirectPlayLobby, 0xaf465c71, 0x9588, 0x11cf, 0xa0, 0x20, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac);
  24. /* {26C66A70-B367-11cf-A024-00AA006157AC} */
  25. DEFINE_GUID(IID_IDirectPlayLobbyA, 0x26c66a70, 0xb367, 0x11cf, 0xa0, 0x24, 0x0, 0xaa, 0x0, 0x61, 0x57, 0xac);
  26.  
  27.  
  28.  
  29. /****************************************************************************
  30.  *
  31.  * IDirectPlayLobby Structures
  32.  *
  33.  * Various structures used to invoke DirectPlayLobby.
  34.  *
  35.  ****************************************************************************/
  36.  
  37. typedef struct IDirectPlayLobby     FAR *LPDIRECTPLAYLOBBY;
  38. typedef struct IDirectPlayLobby     FAR *LPDIRECTPLAYLOBBYA;
  39. typedef struct IDirectPlayLobby     IDirectPlayLobbyA;
  40.  
  41.  
  42. /*
  43.  * DPLCONNECTION
  44.  * Used to hold all in the informaion needed to connect
  45.  * an application to a session or create a session
  46.  */
  47. typedef struct DPLCONNECTION
  48. {
  49.     DWORD               dwSize;             // Size of this structure
  50.     DWORD               dwFlags;            // Flags specific to this structure
  51.     LPDPSESSIONDESC2    lpSessionDesc;      // Pointer to session desc to use on connect
  52.     LPDPNAME            lpPlayerName;       // Pointer to Player name structure
  53.     GUID                guidSP;             // GUID of the DPlay SP to use
  54.     LPVOID              lpAddress;          // Address for service provider
  55.     DWORD               dwAddressSize;      // Size of address data
  56. } DPLCONNECTION, FAR *LPDPLCONNECTION;
  57.  
  58. /*
  59.  * LPCDPLCONNECTION
  60.  * A constant pointer to DPLCONNECTION
  61.  */
  62. typedef const DPLCONNECTION FAR *LPCDPLCONNECTION;
  63.  
  64. /*
  65.  * This application should create a new session as
  66.  * described by the DPSESIONDESC structure
  67.  */
  68. #define DPLCONNECTION_CREATESESSION         DPOPEN_CREATE
  69.  
  70. /*
  71.  * This application should join the session described by 
  72.  * the DPSESIONDESC structure with the lpAddress data
  73.  */
  74. #define DPLCONNECTION_JOINSESSION           DPOPEN_JOIN
  75.  
  76.  
  77. /*
  78.  * DPLAPPINFO
  79.  * Used to hold information about a registered DirectPlay
  80.  * application
  81.  */
  82. typedef struct DPLAPPINFO
  83. {
  84.     DWORD       dwSize;             // Size of this structure
  85.     GUID        guidApplication;    // GUID of the Application
  86.     union
  87.     {
  88.         LPSTR   lpszAppNameA;       // Pointer to the Application Name
  89.         LPWSTR  lpszAppName;
  90.     };
  91.  
  92. } DPLAPPINFO, FAR *LPDPLAPPINFO;
  93.  
  94. /*
  95.  * LPCDPLAPPINFO
  96.  * A constant pointer to DPLAPPINFO
  97.  */
  98. typedef const DPLAPPINFO FAR *LPCDPLAPPINFO;
  99.  
  100. /****************************************************************************
  101.  *
  102.  * Enumeration Method Callback Prototypes
  103.  *
  104.  ****************************************************************************/
  105.  
  106. /*
  107.  * Callback for EnumAddress()
  108.  */
  109. typedef BOOL (FAR PASCAL *LPDPENUMADDRESSCALLBACK)(
  110.     REFGUID         guidDataType,
  111.     DWORD           dwDataSize,
  112.     LPCVOID         lpData,
  113.     LPVOID          lpContext);
  114.  
  115. /*
  116.  * Callback for EnumAddressTypes()
  117.  */
  118. typedef BOOL (FAR PASCAL *LPDPLENUMADDRESSTYPESCALLBACK)(
  119.     REFGUID         guidDataType,
  120.     LPVOID          lpContext,
  121.     DWORD           dwFlags);
  122.  
  123. /*
  124.  * Callback for EnumLocalApplications()
  125.  */
  126. typedef BOOL (FAR PASCAL * LPDPLENUMLOCALAPPLICATIONSCALLBACK)(
  127.     LPCDPLAPPINFO   lpAppInfo,
  128.     LPVOID          lpContext,
  129.     DWORD           dwFlags);
  130.  
  131.  
  132. /****************************************************************************
  133.  *
  134.  * DirectPlayLobby API Prototypes
  135.  *
  136.  ****************************************************************************/
  137. #ifdef UNICODE
  138. #define DirectPlayLobbyCreate   DirectPlayLobbyCreateW
  139. #else
  140. #define DirectPlayLobbyCreate   DirectPlayLobbyCreateA
  141. #endif /* UNICODE */
  142.  
  143. extern HRESULT WINAPI DirectPlayLobbyCreateW(LPGUID, LPDIRECTPLAYLOBBY *, IUnknown *, LPVOID, DWORD );
  144. extern HRESULT WINAPI DirectPlayLobbyCreateA(LPGUID, LPDIRECTPLAYLOBBYA *, IUnknown *, LPVOID, DWORD );
  145.  
  146.  
  147. /****************************************************************************
  148.  *
  149.  * IDirectPlayLobby (and IDirectPlayLobbyA) Interface
  150.  *
  151.  ****************************************************************************/
  152. #undef INTERFACE
  153. #define INTERFACE IDirectPlayLobby
  154. DECLARE_INTERFACE_( IDirectPlayLobby, IUnknown )
  155. {
  156.     /*  IUnknown Methods        */
  157.     STDMETHOD(QueryInterface)       (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  158.     STDMETHOD_(ULONG,AddRef)        (THIS) PURE;
  159.     STDMETHOD_(ULONG,Release)       (THIS) PURE;
  160.  
  161.     /*  IDirectPlayLobby Methods        */
  162.     STDMETHOD(Connect)              (THIS_ DWORD, LPDIRECTPLAY2 *, IUnknown FAR *) PURE;
  163.     STDMETHOD(CreateAddress)        (THIS_ REFGUID, REFGUID, LPCVOID, DWORD, LPVOID, LPDWORD) PURE;
  164.     STDMETHOD(EnumAddress)          (THIS_ LPDPENUMADDRESSCALLBACK, LPCVOID, DWORD, LPVOID) PURE;
  165.     STDMETHOD(EnumAddressTypes)     (THIS_ LPDPLENUMADDRESSTYPESCALLBACK, REFGUID, LPVOID, DWORD) PURE;
  166.     STDMETHOD(EnumLocalApplications)(THIS_ LPDPLENUMLOCALAPPLICATIONSCALLBACK, LPVOID, DWORD) PURE;
  167.     STDMETHOD(GetConnectionSettings)(THIS_ DWORD, LPVOID, LPDWORD) PURE;
  168.     STDMETHOD(ReceiveLobbyMessage)  (THIS_ DWORD, DWORD, LPDWORD, LPVOID, LPDWORD) PURE;
  169.     STDMETHOD(RunApplication)       (THIS_ DWORD, LPDWORD, LPDPLCONNECTION, HANDLE) PURE;
  170.     STDMETHOD(SendLobbyMessage)     (THIS_ DWORD, DWORD, LPVOID, DWORD) PURE;
  171.     STDMETHOD(SetConnectionSettings)(THIS_ DWORD, DWORD, LPDPLCONNECTION) PURE;
  172.     STDMETHOD(SetLobbyMessageEvent) (THIS_ DWORD, DWORD, HANDLE) PURE;
  173.  
  174. };
  175.  
  176. /****************************************************************************
  177.  *
  178.  * IDirectPlayLobby interface macros
  179.  *
  180.  ****************************************************************************/
  181.  
  182. #if !defined(__cplusplus) || defined(CINTERFACE)
  183.  
  184. #define IDirectPlayLobby_QueryInterface(p,a,b)              (p)->lpVtbl->QueryInterface(p,a,b)
  185. #define IDirectPlayLobby_AddRef(p)                          (p)->lpVtbl->AddRef(p)
  186. #define IDirectPlayLobby_Release(p)                         (p)->lpVtbl->Release(p)
  187. #define IDirectPlayLobby_Connect(p,a,b,c)                   (p)->lpVtbl->Connect(p,a,b,c)
  188. #define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f)       (p)->lpVtbl->CreateAddress(p,a,b,c,d,e,f)
  189. #define IDirectPlayLobby_EnumAddress(p,a,b,c,d)             (p)->lpVtbl->EnumAddress(p,a,b,c,d)
  190. #define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d)        (p)->lpVtbl->EnumAddressTypes(p,a,b,c,d)
  191. #define IDirectPlayLobby_EnumLocalApplications(p,a,b,c)     (p)->lpVtbl->EnumLocalApplications(p,a,b,c)
  192. #define IDirectPlayLobby_GetConnectionSettings(p,a,b,c)     (p)->lpVtbl->GetConnectionSettings(p,a,b,c)
  193. #define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e)   (p)->lpVtbl->ReceiveLobbyMessage(p,a,b,c,d,e)
  194. #define IDirectPlayLobby_RunApplication(p,a,b,c,d)          (p)->lpVtbl->RunApplication(p,a,b,c,d)
  195. #define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d)        (p)->lpVtbl->SendLobbyMessage(p,a,b,c,d)
  196. #define IDirectPlayLobby_SetConnectionSettings(p,a,b,c)         (p)->lpVtbl->SetConnectionSettings(p,a,b,c)
  197. #define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c)      (p)->lpVtbl->SetLobbyMessageEvent(p,a,b,c)
  198.  
  199. #else /* C++ */
  200.  
  201. #define IDirectPlayLobby_QueryInterface(p,a,b)              (p)->QueryInterface(a,b)
  202. #define IDirectPlayLobby_AddRef(p)                          (p)->AddRef()
  203. #define IDirectPlayLobby_Release(p)                         (p)->Release()
  204. #define IDirectPlayLobby_Connect(p,a,b,c)                   (p)->Connect(a,b,c)
  205. #define IDirectPlayLobby_CreateAddress(p,a,b,c,d,e,f)       (p)->CreateAddress(a,b,c,d,e,f)
  206. #define IDirectPlayLobby_EnumAddress(p,a,b,c,d)             (p)->EnumAddress(a,b,c,d)
  207. #define IDirectPlayLobby_EnumAddressTypes(p,a,b,c,d)        (p)->EnumAddressTypes(a,b,c,d)
  208. #define IDirectPlayLobby_EnumLocalApplications(p,a,b,c)     (p)->EnumLocalApplications(a,b,c)
  209. #define IDirectPlayLobby_GetConnectionSettings(p,a,b,c)     (p)->GetConnectionSettings(a,b,c)
  210. #define IDirectPlayLobby_ReceiveLobbyMessage(p,a,b,c,d,e)   (p)->ReceiveLobbyMessage(a,b,c,d,e)
  211. #define IDirectPlayLobby_RunApplication(p,a,b,c,d)          (p)->RunApplication(a,b,c,d)
  212. #define IDirectPlayLobby_SendLobbyMessage(p,a,b,c,d)        (p)->SendLobbyMessage(a,b,c,d)
  213. #define IDirectPlayLobby_SetConnectionSettings(p,a,b,c)         (p)->SetConnectionSettings(a,b,c)
  214. #define IDirectPlayLobby_SetLobbyMessageEvent(p,a,b,c)      (p)->SetLobbyMessageEvent(a,b,c)
  215.  
  216. #endif
  217.  
  218. /****************************************************************************
  219.  *
  220.  * DirectPlayLobby Flags
  221.  *
  222.  ****************************************************************************/
  223.  
  224. /*
  225.  *      This flag is a message flag used by GetApplicationData.  It can be
  226.  *      returned in the dwMessageFlags parameter to indicate a message from
  227.  *      the system.
  228.  */
  229. #define DPLAD_SYSTEM                    0x00000001
  230.  
  231.  
  232. /****************************************************************************
  233.  *
  234.  * DirectPlayLobby system messages and message data structures
  235.  *
  236.  * All system message have a dwMessageFlags value of DPLAD_SYSTEM returned
  237.  * from a call to GetApplicationData.  
  238.  *
  239.  ****************************************************************************/
  240.  
  241. /*
  242.  * DPLMSG_GENERIC
  243.  * Generic message structure used to identify the message type.
  244.  */
  245. typedef struct DPLMSG_GENERIC
  246. {
  247.     DWORD       dwType;         // Message type
  248. } DPLMSG_GENERIC, FAR *LPDPLMSG_GENERIC;
  249.  
  250.  
  251. /******************************************
  252.  *
  253.  *      Sytem message dwType values
  254.  *
  255.  *****************************************/
  256.  
  257. /*
  258.  *  The application has read the connection settings.
  259.  *  It is now O.K. for the lobby client to release
  260.  *  its IDirectPlayLobby interface.
  261.  */
  262. #define DPLSYS_CONNECTIONSETTINGSREAD   0x00000001
  263.  
  264. /*
  265.  *  The application's call to DirectPlayConnect failed
  266.  */
  267. #define DPLSYS_DPLAYCONNECTFAILED       0x00000002
  268.  
  269. /*
  270.  *  The application has created a DirectPlay session.
  271.  */
  272. #define DPLSYS_DPLAYCONNECTSUCCEEDED    0x00000003
  273.  
  274. /*
  275.  *  The application has terminated.
  276.  */
  277. #define DPLSYS_APPTERMINATED            0x00000004
  278.  
  279.  
  280. /****************************************************************************
  281.  *
  282.  * DirectPlay Address ID's
  283.  *
  284.  ****************************************************************************/
  285.  
  286. /* DirectPlay Address
  287.  *
  288.  * A DirectPlay address consists of multiple chunks of data, each tagged
  289.  * with a GUID signifying the type of data in the chunk. The chunk also
  290.  * has a length so that unknown chunk types can be skipped.
  291.  *
  292.  * The EnumAddress() function is used to parse these address data chunks.
  293.  * The address data is passed to the SPInit method in the lpAddress field
  294.  * and the size is passed in the dwAddressSize field. These parameters are
  295.  * then passed to EnumAddress() to enumerate the tags.
  296.  */
  297.  
  298. /*
  299.  * DPADDRESS
  300.  *
  301.  * Header for block of address data elements
  302.  */
  303. typedef struct _DPADDRESS
  304. {
  305.     GUID                guidDataType;
  306.     DWORD               dwDataSize;
  307. } DPADDRESS;
  308.  
  309. typedef DPADDRESS FAR* LPDPADDRESS;
  310.  
  311.  /*
  312.  * DPAID_ServiceProvider
  313.  *
  314.  * Chunk is a GUID describing the service provider that created the chunk.
  315.  * All addresses must contain this chunk.
  316.  */
  317.  
  318. // {07D916C0-E0AF-11cf-9C4E-00A0C905425E}
  319. DEFINE_GUID(DPAID_ServiceProvider, 
  320. 0x7d916c0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  321.  
  322. /*
  323.  * DPAID_Phone
  324.  *
  325.  * Chunk is a string containing a phone number (i.e. "1-800-555-1212")
  326.  */
  327.  
  328. // {78EC89A0-E0AF-11cf-9C4E-00A0C905425E}
  329. DEFINE_GUID(DPAID_Phone, 
  330. 0x78ec89a0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  331.  
  332. /*
  333.  * DPAID_Inet
  334.  *
  335.  * Chunk is a string containing a TCP/IP host name or an IP address
  336.  *(i.e. "dplay.microsoft.com" or "137.55.100.173")
  337.  */
  338.  
  339. // {C4A54DA0-E0AF-11cf-9C4E-00A0C905425E}
  340. DEFINE_GUID(DPAID_INet, 
  341. 0xc4a54da0, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  342.  
  343. /*
  344.  * DPCOMPORTADDRESS
  345.  *
  346.  * Used to specify com port settings. The constants that define baud rate,
  347.  * stop bits and parity are defined in WINBASE.H. The constants for flow
  348.  * control are given below.
  349.  */
  350.  
  351. #define DPCPA_NOFLOW        0           // no flow control
  352. #define DPCPA_XONXOFFFLOW   1           // software flow control
  353. #define DPCPA_RTSFLOW       2           // hardware flow control with RTS
  354. #define DPCPA_DTRFLOW       3           // hardware flow control with DTR
  355. #define DPCPA_RTSDTRFLOW    4           // hardware flow control with RTS and DTR
  356.  
  357. typedef struct _DPCOMPORTADDRESS
  358. {
  359.     DWORD   dwComPort;                  // COM port to use (1-4)
  360.     DWORD   dwBaudRate;                 // baud rate (100-256k)
  361.     DWORD   dwStopBits;                 // no. stop bits (1-2)
  362.     DWORD   dwParity;                   // parity (none, odd, even, mark)
  363.     DWORD   dwFlowControl;              // flow control (none, xon/xoff, rts, dtr)
  364. } DPCOMPORTADDRESS;
  365.  
  366. typedef DPCOMPORTADDRESS FAR* LPDPCOMPORTADDRESS;
  367.  
  368. /*
  369.  * DPAID_ComPort
  370.  *
  371.  * Chunk contains a DPCOMPORTADDRESS structure defining the serial port.
  372.  */
  373.  
  374. // {F2F0CE00-E0AF-11cf-9C4E-00A0C905425E}
  375. DEFINE_GUID(DPAID_ComPort, 
  376. 0xf2f0ce00, 0xe0af, 0x11cf, 0x9c, 0x4e, 0x0, 0xa0, 0xc9, 0x5, 0x42, 0x5e);
  377.  
  378. #ifdef __cplusplus
  379. };
  380. #endif /* __cplusplus */
  381.  
  382. #pragma option pop
  383. #endif /* __DPLOBBY_INCLUDED__ */
  384.